package com.acme;


public class Test {
	public static void main(String[] args) {
		int v1 = 3;
		// ERROR ahead: narrowing conversion
		// Use int type instead of byte for v2 variable
		// byte v2 = v1;
		int v2 = v1;
		System.out.println(v2); // 3, trivial now
		v1 = 256;
		// max value for byte is 127, so the same story here. Not possible, but actual narrowing conversion. Use int instead of byte
		int v3 = v1;
		System.out.println(v3); // 256, same
		int v4 = 's';
		System.out.println(v4); // ascii table value for 's' is equal to 115
		
		byte v5 = 115;
		if (v5 == 's') {
			System.out.println("Equals"); // == is operator, byte convert to int
		}
		
		//TODO: What exactly will be printed?
		System.out.println((double)4); // 4.0, because it is floating point number, not int
		
		//TODO: What exactly will be printed?
		double d = 5; // 5.0 already
		System.out.println(d + 1); // 1 converts to double, then sum up to doubles, so the result is 6.0
		
		// cannot convert int to boolean
		// boolean b = v4;
		int b = v4; 
		
		// cannot convert String to short
		// short v6 = "short";
		String v6 = "short";
		
		// Narrowing conversion double to float. Use f or F in the end of literal to specify that it is float not double
		// float v7 = 3.67;
		float v7 = 3.67F;
		
		float v9 = 3;//TODO: Why there is no compilation error?
		// It is not narrowing conversion, but widening.
		
		// Attempt to make narrowing conversion float to int
		// int v8 = v7;
		float v8 = v7;
		
		// Cannot use String as a array length, use int instead
		// Cannot convert double[] to int[], use int instead
		// int array[] = new double["27"];
		int array[] = new int[27];
	}
}